package com.xhwl.centiotdata.pojo.enums.pedestrian;

import org.springframework.util.StringUtils;

/**
 * @Author： wangyiling
 * @Description：
 * @Date 2022/08/03 15:50
 */
public enum OpenUserTypeEnum {
    HZ_TYPE(1, "海珠局员工", "HZ"),
    ESTATE_TYPE(2, "物业员工", "TLD"),
    ZT_TYPE(4, "17楼展厅", "ZT"),
    ZDCM_TYPE(5, "中电传媒", "ZDCM"),
    ZC_TYPE(6, "中诚公司", "ZC"),
    CH_TYPE(7, "从化公司", "CH"),
    NTJT_TYPE(8, "南投集团", "NTJT"),
    NFJ_TYPE(9, "南方局", "NFJ"),
    ND_TYPE(10, "南电公司", "ND"),
    CB_TYPE(11, "城北公司", "CB"),
    ZD_TYPE(12, "增电集团", "ZD"),
    GC_TYPE(13, "工程公司", "GC"),
    SJY_TYPE(14, "工程设计院", "SJY"),
    GZJ_TYPE(15, "广州供电局", "GZJ"),
    FDC_TYPE(16, "房地产公司", "FDC"),
    JSZJ_TYPE(28, "竣盛公司", "JSZJ"),
    JS_TYPE(17, "技术公司", "JS"),
    ZH_TYPE(18, "正航公司", "ZH"),
    QNY_TYPE(19, "氢能源研究中心", "QNY"),
    HX_TYPE(20, "汇隽公司", "HX"),
    TJ_TYPE(21, "泰捷公司", "TJ"),
    DQ_TYPE(22, "电器公司", "DQ"),
    DA_TYPE(23, "电安公司", "DA"),
    DJ_TYPE(24, "电建公司", "DJ"),
    PD_TYPE(25, "番电公司", "PD"),
    KJ_TYPE(26, "科技公司", "KJ"),
    KT_TYPE(27, "科腾公司", "KT"),
    YH_TYPE(29, "翌弘公司", "YH"),
    XN_TYPE(30, "西南公司", "XN"),
    TLD_TYPE(31, "通力达公司", "TLD"),
    JL_TYPE(32, "隽力公司", "JL"),
    HS_TYPE(33, "鸿尚公司", "HS"),
    HEAD_TYPE(3, "总部员工", ""),
    INVALID_TYPE(0, "无效类型","");

    private final int id;

    private final String description;
    private final String code;

    OpenUserTypeEnum(int id, String description, String code) {
        this.id = id;
        this.description = description;
        this.code = code;
    }

    // 根据code获取Id方法
    public static Integer getOpenUserTypeEnumByCode(String typeValue) {
        if (!StringUtils.isEmpty(typeValue)) {
            for (OpenUserTypeEnum c : OpenUserTypeEnum.values()) {
                if (typeValue.startsWith(c.getCode())) {
                    return c.getId();
                }
            }
        }
        return INVALID_TYPE.getId();
    }
    public int getId() {
        return id;
    }
    public String getCode() {
        return code;
    }
}
